home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / net.s5 / tliopt.c < prev    next >
C/C++ Source or Header  |  1989-12-17  |  2KB  |  78 lines

  1. /*
  2.  * Print the information for a given transport provider.
  3.  */
  4.  
  5. #include    <stdio.h>
  6. #include    <fcntl.h>
  7. #include    <tiuser.h>
  8.  
  9. main()
  10. {
  11.     doit("/dev/tcp");
  12.     doit("/dev/udp");
  13. }
  14.  
  15. doit(name)
  16. char    *name;
  17. {
  18.     int        tfd;
  19.     struct t_info    info;
  20.  
  21.     if ( (tfd = t_open(name, O_RDWR, &info)) < 0)
  22.         err_sys("can't open %s", name);
  23.  
  24.     printf("Protocol = %s", name);
  25.     printf("\n  %8ld: max size of address", info.addr);
  26.         if (info.addr == -2)
  27.             printf(" (no user access to addresses)");
  28.         else if (info.addr == -1)
  29.             printf(" (no limit on size of address)");
  30.  
  31.     printf("\n  %8ld: max #bytes of options", info.options);
  32.         if (info.options == -2)
  33.             printf(" (not supported)");
  34.         else if (info.options == -1)
  35.             printf(" (no limit on option size)");
  36.  
  37.     printf("\n  %8ld: max size of data unit", info.tsdu);
  38.         if (info.tsdu == -2)
  39.             printf(" (transfer of normal data is not supported)");
  40.         else if (info.tsdu == -1)
  41.             printf(" (no limit on size of data unit)");
  42.         else if (info.tsdu == 0)
  43.             printf(" (data has no logical boundaries)");
  44.  
  45.     printf("\n  %8ld: max size of expedited data unit", info.etsdu);
  46.         if (info.etsdu == -2)
  47.             printf(" (transfer of normal data is not supported)");
  48.         else if (info.etsdu == -1)
  49.             printf(" (no limit on size of data unit)");
  50.         else if (info.etsdu == 0)
  51.             printf(" (data has no logical boundaries)");
  52.  
  53.     printf("\n  %8ld: max amount of data with connect", info.connect);
  54.         if (info.connect == -2)
  55.             printf(" (not allowed)");
  56.         else if (info.connect == -1)
  57.             printf(" (no limit)");
  58.  
  59.     printf("\n  %8ld: max amount of data with disconnect", info.discon);
  60.         if (info.discon == -2)
  61.             printf(" (not allowed)");
  62.         else if (info.discon == -1)
  63.             printf(" (no limit)");
  64.  
  65.     printf("\n  %8ld: service type", info.servtype);
  66.         if (info.servtype == T_COTS)
  67.             printf(" (connection-oriented withOUT orderly release)");
  68.         else if (info.servtype == T_COTS_ORD)
  69.             printf(" (connection-oriented WITH orderly release)");
  70.         else if (info.servtype == T_CLTS)
  71.             printf(" (connectionless)");
  72.         else
  73.             printf(" (??????)");
  74.         putchar('\n');
  75.  
  76.     fflush(stdout);
  77. }
  78.